package com.zzb.framework;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.PropertySource;

import javax.servlet.ServletContextEvent;
import javax.servlet.ServletContextListener;

/**
 * 框架启动方法
 * Created by zhangzhenbin on 17-5-2.
 */
@SpringBootApplication
public class FrameworkMain  {
    private static final Logger logger = LoggerFactory.getLogger(FrameworkMain.class);

    public static void main(String[] args) {

        SpringApplication.run(FrameworkMain.class, args);

    }


    @Bean
    protected ServletContextListener listener() {
        return new ServletContextListener() {

            @Override
            public void contextInitialized(ServletContextEvent sce) {
                logger.info("Framework ServletContext initialized");
            }

            @Override
            public void contextDestroyed(ServletContextEvent sce) {
                logger.info("Framework ServletContext destroyed");
            }

        };
    }
}
